<%@ page language="java" pageEncoding="UTF-8" buffer="16kb"%>
<%@ include file="/base.jsp"%>
<%@ include file="/module/taglibs.jsp"%>
<%@ include file="/module/nocache.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<%@ include file="/module/js.jsp"%>
<%@ include file="/module/orderField.jsp"%>
     <script type="text/javascript" src="${basePath}/js/jquery.Huploadify.js"></script>
     <link href="${basePath}/css/Huploadify.css" rel="stylesheet">

<style>

table label.error {
    margin-left: 5px;
    width: auto;
    display: inline;
    color: red;
}
</style>




<script>
$(document).ready(
					function() {
						$("#div1").dialog({
							width : 'auto',
							height : 'auto',
							bgiframe : true,
							modal : true,
							draggable : true,
							resizable : false,
							title : '选择学生',
							autoOpen : false,
						    buttons : {
						    '取消' : function() {
						    	$(this).dialog('close');
							},
							'确定' : function() {
							
							  if($("#fromSelect").val()==null||$("#fromSelect").val()==""){
								 layer.alert("请选择一项", {icon: 6});
								 return false;
							  }else{
								    var formSelect = document.getElementById("fromSelect");
								    var str = [];
								    var num=0;
								    for(i=0;i<formSelect.length;i++){
								        if(formSelect.options[i].selected){
								            num++;
								        }
								    }
								    if(num>=2){
								      layer.alert("只能选择一项", {icon: 6});
								      return false;
								    }else{
								    	var result = $.parseJSON('${studentListJson}');
								    	$("#fqrid").val($("#fromSelect").val())
								        $("#fqrxm").val($("#fromSelect").find("option:selected").text()); 
								    	
										/* for (var i = 0; i < result.length; i++) {
											if(xsid==result[i].xsid){
										     $("#fqrid").val(result[i].xsid);	
										     $("#xm").val(result[i].xm);
											 $("#xh").val(result[i].xh);
											
											 $("#xb").val(result[i].xb);
											 $("#bjmc").val(result[i].bjmc);
											 $("#zymc").val(result[i].zymc);
											 $("#njmc").val(result[i].njmc); 
											 break;
											}
										} */
										 $(this).dialog('close');
								    }
								    
							  }
							  
							}
						  }
						});
						
						
						
						
						$("#divsz").dialog({
							width : 'auto',
							height : 'auto',
							bgiframe : true,
							modal : true,
							draggable : true,
							resizable : false,
							title : '选择学生',
							autoOpen : false,
						    buttons : {
						    '取消' : function() {
						    	$(this).dialog('close');
							},
							'确定' : function() {
							
							  if($("#fromSelectStu").val()==null||$("#fromSelectStu").val()==""){
								  layer.alert("请选择一项", {icon: 6});
								 return false;
							  }else{
								    var formSelect = document.getElementById("fromSelectStu");
								    var str = [];
								    var num=0;
								    for(i=0;i<formSelect.length;i++){
								        if(formSelect.options[i].selected){
								            num++;
								        }
								    }
								    if(num>=2){
								      layer.alert("只能选择一项", {icon: 6});
								      return false;
								    }else{
								    	 $("#szxm").val($("#fromSelectStu").find("option:selected").text()); 
										 $("#szid").val($("#fromSelectStu").val());
										 $(this).dialog('close');
								    }
								    
							  }
							  
							}
						  }
						});
						
						
						
						$("#divzdls").dialog({
							width : 'auto',
							height : 'auto',
							bgiframe : true,
							modal : true,
							draggable : true,
							resizable : false,
							title : '选择老师',
							autoOpen : false,
						    buttons : {
						    '取消' : function() {
						    	$(this).dialog('close');
							},
							'确定' : function() {
							
							  if($("#fromSelectTeachers").val()==null||$("#fromSelectTeachers").val()==""){
								  layer.alert("请选择一项", {icon: 6});
								 return false;
							  }else{
								    var formSelect = document.getElementById("fromSelectTeachers");
								    var str = [];
								    var num=0;
								    for(i=0;i<formSelect.length;i++){
								        if(formSelect.options[i].selected){
								            num++;
								        }
								    }
								    if(num>=2){
								      layer.alert("只能选择一项", {icon: 6});
								      return false;
								    }else{
								    	 $("#zdlsxm").val($("#fromSelectTeachers").find("option:selected").text()); 
										 $("#zdlsid").val($("#fromSelectTeachers").val());
										 $(this).dialog('close');
								    }
								    
							  }
							  
							}
						  }
						});
						

					});
	function showfqr() {
		$('#div1').dialog('open');
	}
	
	function showsz() {
		$('#divsz').dialog('open');
	}
	
	function showzdls() {
		$('#divzdls').dialog('open');
	}
	
</script>



</head>
<body>
     <form action="#" name="Form" id="Form" method="post">
        <input type="hidden" name="stid" id="stid"  value="${data.stid}"/>
		 <table cellpadding="0" cellspacing="0" border="0" class="table-border" width="95%" >
			<tr>
				<td class="table-header" colspan="4">社团申请信息</td>
			</tr>
			<tr>
				<td class="table-titleTD" style="width: 15%"><font style="color: red;">*</font>社团名称:</td>
				<td class="table-contentTD" style="width: 35%">
				   <input type="text" name="stmc" id="stmc" placeholder="社团姓名" value="${data.stmc}" autocomplete="off"  class="inputText required"  autocomplete="off"/></td>
				</td>
		
		      <td class="table-titleTD" style="width: 15%">成立时间:</td>
				<td class="table-contentTD">
				<input name="clsj" id="clsj" placeholder="成立时间"   autocomplete="off" value="${data.clsj}" 
									class="Wdate text inputText2" onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"/></td>
			</tr>
			<tr>
			    <td class="table-titleTD" style="width: 15%">状态：</td>
				<td class="table-contentTD">
				<select id="states" name="states" class="selectList">
						<option value="0">未提交</option>
				</select></td>
				
                <td class="table-titleTD" style="width: 15%"><font style="color: red;">*</font>发起人:</td>
				<td class="table-contentTD">
			     <input type="hidden" name="fqrid" id="fqrid"  value="${data.fqrid}" />
				<input type="text" id="fqrxm" name="fqrxm"  placeholder="发起人"    value="${data.fqrxm}"  readonly="readonly"  style="width: 92%"  class="required inputText" />
				<input type="button" id="butstu"  value="选择" class="inputButton" onclick="javascript:showfqr();" />
				</td>
			</tr>
		  <tr>
			    <td class="table-titleTD" style="width: 15%"><font style="color: red;">*</font>社长:</td>
				<td class="table-contentTD">
			     <input type="hidden" name="szid" id="szid"   value="${data.szid}" />
				<input type="text" id="szxm" name="szxm" placeholder="社长"   value="${data.szxm}"  readonly="readonly"  style="width: 92%"  class="required inputText" />
				<input type="button" id="butstu"  value="选择" class="inputButton" onclick="javascript:showsz();" />
				</td>
				
			    <td class="table-titleTD" style="width: 15%"><font style="color: red;">*</font>指导老师:</td>
				<td class="table-contentTD">
			     <input type="hidden" name="zdlsid" id="zdlsid"  value="${data.zdlsid}"  />
				<input type="text" id="zdlsxm" name="zdlsxm" placeholder="指导老师"    value="${data.zdlsxm}"   readonly="readonly"  style="width: 92%"  class="required inputText" />
				<input type="button" id="butstu"  value="选择" class="inputButton" onclick="javascript:showzdls();" />
				</td>
			</tr>
			
			<tr>
			    <td class="table-titleTD" style="width: 15%">申请人:</td>
			    <td class="table-contentTD">${data.creatorname}
			    <input type="hidden" name="creatorid" id="creatorid"  value="${data.creatorid}"/>
				<input type="hidden" id="creatorname" name="creatorname" placeholder="申请人"   value="${data.creatorname}"  maxlength="8" class="inputText" /></td>
			    <td class="table-contentTD" colspan="2"></td>
			</tr>
		   
			<tr>
				<td class="table-titleTD"  style="width: 15%"><font style="color: red;">*</font>现有人员与岗位配置:</td>
				<td class="table-contentTD" colspan="3" style="width: 100%"><textarea style="width: 90%;height: 80px;"  name="rygw"       class="required" autocomplete="off" placeholder="备注" id="rygw" maxlength="2000" >${data.rygw}</textarea></td>
			</tr>
			<tr>
				<td class="table-titleTD"  style="width: 15%"><font style="color: red;">*</font>服务宗旨:</td>
				<td class="table-contentTD" colspan="3" style="width: 100%"><textarea style="width: 90%;height: 80px;"  name="fwzz"    class="required"  autocomplete="off"  placeholder="备注" id="fwzz" maxlength="2000" >${data.fwzz}</textarea></td>
			</tr>
            <tr>
				<td class="table-titleTD"  style="width: 15%"><font style="color: red;">*</font>学年计划:</td>
				<td class="table-contentTD" colspan="3" style="width: 100%"><textarea style="width: 90%;height: 80px;"  name="xnjh"   class="required" autocomplete="off" placeholder="备注" id="xnjh" maxlength="2000" >${data.xnjh}</textarea></td>
			</tr>
			<tr>
				<td class="table-titleTD"  style="width: 15%"><font style="color: red;">*</font>规章制度:</td>
				<td class="table-contentTD" colspan="3" style="width: 100%"><textarea  style="width: 90%;height: 80px;"  name="gzzd" class="required"  autocomplete="off" placeholder="备注" id="gzzd" maxlength="2000" >${data.gzzd}</textarea></td>
			</tr>			
		</table>
	 </form>
		<br />
		
		
		
		  <div id="div1" style="display: none;">
				<table cellpadding="0" cellspacing="0" border="0" class="table-border">
					  <tr>
						  	 <td style="clear:both; width: 70%">
						  	  <input class="text" name="searchemp" ondblclick="javascript:filterSelectItems('sourseFromSelect2','fromSelect','fromSelect',this.value);"  onkeyup="javascript:filterSelectItems('sourseFromSelect2','fromSelect','fromSelect',this.value);"/><font color="green">在此查找</font> <br/>
						  	   <br/><label style="color:red;">未选中:</label><br/>
						  	   <select name="fromSelect" id="fromSelect" multiple="multiple"  size="1"  multiple="false" style="width:200px; height: 250px;"
									ondblclick="moveField('fromSelect','toSelect');">
													<c:forEach items="${studentList}" var="data">
									       <option value="${data.xsid}">${data.xm}</option>
								          </c:forEach>
								</select>
									<select name="sourseFromSelect2" id="sourseFromSelect2"   multiple="false" style="width: 220px; height: 150px; display: none;" >
													<c:forEach items="${studentList}" var="data">
									                 <option value="${data.xsid}">${data.xm}</option>
								                    </c:forEach>
		  	                        </select>
							  </td>
	  	              </tr>
				</table>
		    </div>
		 
		 
		    <div id="divsz" style="display: none;">
				<table cellpadding="0" cellspacing="0" border="0" class="table-border">
					  <tr>
						  	 <td style="clear:both; width: 70%">
						  	  <input class="text" name="searchemp" ondblclick="javascript:filterSelectItems('sourseFromSelect2Stu','fromSelectStu','fromSelectStu',this.value);"  onkeyup="javascript:filterSelectItems('sourseFromSelect2Stu','fromSelectStu','fromSelectStu',this.value);"/><font color="green">在此查找</font> <br/>
						  	   <br/><label style="color:red;">未选中:</label><br/>
						  	   <select name="fromSelectStu" id="fromSelectStu" multiple="multiple"  size="1"  multiple="false" style="width:200px; height: 250px;"
									ondblclick="moveField('fromSelectStu','toSelect');">
													<c:forEach items="${studentList}" var="data">
									       <option value="${data.xsid}">${data.xm}</option>
								          </c:forEach>
								</select>
									<select name="sourseFromSelect2Stu" id="sourseFromSelect2Stu"   multiple="false" style="width: 220px; height: 150px; display: none;" >
													<c:forEach items="${studentList}" var="data">
									                 <option value="${data.xsid}">${data.xm}</option>
								                    </c:forEach>
		  	                        </select>
							  </td>
	  	              </tr>
				</table>
		   </div>
		 
		 
		   <div id="divzdls" style="display: none;">
				<table cellpadding="0" cellspacing="0" border="0" class="table-border">
					  <tr>
						  	 <td style="clear:both; width: 70%">
						  	  <input class="text" name="searchemp" ondblclick="javascript:filterSelectItems('sourseFromSelect2Teachers','fromSelectTeachers','fromSelectTeachers',this.value);"  onkeyup="javascript:filterSelectItems('sourseFromSelect2Teachers','fromSelectTeachers','fromSelectTeachers',this.value);"/><font color="green">在此查找</font> <br/>
						  	   <br/><label style="color:red;">未选中:</label><br/>
						  	   <select name="fromSelectTeachers" id="fromSelectTeachers" multiple="multiple"  size="1"  multiple="false" style="width:200px; height: 250px;"
									ondblclick="moveField('fromSelectTeachers','toSelect');">
													<c:forEach items="${EmployeeList}" var="data">
									       <option value="${data.emid}">${data.xm}</option>
								          </c:forEach>
								</select>
									<select name="sourseFromSelect2Teachers" id="sourseFromSelect2Teachers"   multiple="false" style="width: 220px; height: 150px; display: none;" >
													<c:forEach items="${EmployeeList}" var="data">
									                     <option value="${data.emid}">${data.xm}</option>
								                    </c:forEach>
		  	                        </select>
							  </td>
	  	              </tr>
				</table>
		    </div>
		    
		    
		<table cellpadding="1" cellspacing="1" border="0" align="left">
			<tr>
			    <td><input type="button" id="btnSave" class="inputButton" style="text-align: center;" value="保存"  autocomplete="off"/></td>
				<td><input type="button" id="Cancel" class="inputButton" style="text-align: center;" value="取消"  autocomplete="off"/></td>
				<td><input type="button" id="returnBut" class="inputButton" value="返回" style="text-align: center;" autocomplete="off"/></td>
			</tr>
		</table>
		
		<script>
		
			$(document).ready(function() {
				var _form=$("#Form").validate();
				$("#btnSave").click(function() {
					if(_form.form()){
						  validateObj();
					}
				});
				
				
				function validateObj(){
				  	/* $.ajax({
						  type: 'POST',
						  url: "${basePath}/bjxxClassWorkInstead/validation",
					      data:{xmmc : $('#xmmc').val(),id:$('#xmid').val()},
						  success:function(data){
						   if(data.msg=="-99"){
							     layer.alert('服务器异常', {icon: 5});
							     return false;
						   }else if(data.msg!='0'){
							     layer.alert('项目名称已经存在请重新输入', {icon: 5});
							     return false;
						   }else{ */
							    document.Form.action ="${basePath}/twglStudentCorporation/update";
								document.Form.submit();
						  /*  }   
						  }
						});	 */
				}
				
				
				
				$("#Cancel").click(function() {
					   window.location.href ="${basePath}/twglStudentCorporation/details?id="+ $("#stid").val();
		 		});
				
				$("#returnBut").click(function() {
		 			 window.location.href='${basePath}/twglStudentCorporation/index';
		 		});
			});
		</script>
</body>
</html>
